package controller.instrutor;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import model.aluno.InstrutorDAO;
import model.pessoa.Instrutor;
import view.View;
import view.aluno.InstrutorCadastro;
import view.instrutor.InstrutorPesquisa;


public class InstrutorController implements ActionListener, MouseListener{
	
	private View view;
	private InstrutorDAO dao;
	private Instrutor instrutor;
	
	public InstrutorController(View view, Instrutor instrutor){
		this.view = view;
		this.instrutor = instrutor;
		
		dao = new InstrutorDAO();
	}

	public View getView() {
		return view;
	}

	public void setView(View view) {
		this.view = view;
	}

	public InstrutorDAO getDao() {
		return dao;
	}

	public void setDao(InstrutorDAO dao) {
		this.dao = dao;
	}

	public Instrutor getInstrutor() {
		return instrutor;
	}

	public void setInstrutor(Instrutor instrutor) {
		this.instrutor = instrutor;
	}

	public void exibirTelaCadastro() {
		view.fechar();
		view = new InstrutorCadastro(this);
		view.exibir();
	}
	
	public void prepararObjeto() {
		String matricula = ((InstrutorCadastro) view).getTxMaricula().getText();
		String nome = ((InstrutorCadastro) view).getTxNome().getText();
		
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equals("novo")) {
			exibirTelaCadastro();
		}
		
		if (e.getActionCommand().equals("salvar")) {
			//dao.salvarAluno(aluno);
		}
		
		if (e.getActionCommand().equals("pesquisar")){
			if (view instanceof InstrutorPesquisa){
				
			}
		}
		
		
	}
	
	
	
	
}
